From 5fb86cf7daf3a19df7475b7d2f4c4dc71d58096e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 26 Jun 2011 21:14:08 -0400 Subject: [PATCH] Convert GailScale to GtkScaleAccessible --- gtk/a11y/Makefile.am | 4 +- gtk/a11y/gail.c | 3 -- gtk/a11y/gailscale.h | 54 ------------------- .../{gailscale.c => gtkscaleaccessible.c} | 39 +++++++------- gtk/a11y/gtkscaleaccessible.h | 52 ++++++++++++++++++ gtk/gtkscale.c | 4 ++ 6 files changed, 76 insertions(+), 80 deletions(-) delete mode 100644 gtk/a11y/gailscale.h rename gtk/a11y/{gailscale.c => gtkscaleaccessible.c} (71%) create mode 100644 gtk/a11y/gtkscaleaccessible.h diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am index daad6716db..ca2181d15c 100644 --- a/gtk/a11y/Makefile.am +++ b/gtk/a11y/Makefile.am @@ -38,7 +38,7 @@ gail_c_sources = \ gailradiosubmenuitem.c \ gailrange.c \ gailrenderercell.c \ - gailscale.c \ + gtkscaleaccessible.c \ gailscalebutton.c \ gailscrollbar.c \ gailscrolledwindow.c \ @@ -93,7 +93,7 @@ gail_private_h_sources = \ gailradiosubmenuitem.h \ gailrange.h \ gailrenderercell.h \ - gailscale.h \ + gtkscaleaccessible.h \ gailscalebutton.h \ gailscrollbar.h \ gailscrolledwindow.h \ diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c index 4951541c80..b9e25f6ce9 100644 --- a/gtk/a11y/gail.c +++ b/gtk/a11y/gail.c @@ -49,7 +49,6 @@ #include "gailradiomenuitem.h" #include "gailrenderercell.h" #include "gailrange.h" -#include "gailscale.h" #include "gailscalebutton.h" #include "gailscrollbar.h" #include "gailscrolledwindow.h" @@ -121,7 +120,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU_SHELL, GailMenuShell, gail_menu_shell, GT GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RANGE, GailRange, gail_range, GTK_TYPE_RANGE) -GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE, GailScale, gail_scale, GTK_TYPE_SCALE) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE_BUTTON, GailScaleButton, gail_scale_button, GTK_TYPE_SCALE_BUTTON) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_TYPE_STATUSBAR) GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK) @@ -895,7 +893,6 @@ gail_accessibility_module_init (void) GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU, gail_menu); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WINDOW, gail_window); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RANGE, gail_range); - GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE, gail_scale); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE_BUTTON, gail_scale_button); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar); GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook); diff --git a/gtk/a11y/gailscale.h b/gtk/a11y/gailscale.h deleted file mode 100644 index d0c843fbbc..0000000000 --- a/gtk/a11y/gailscale.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation Library - * Copyright 2004 Sun Microsystems Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GAIL_SCALE_H__ -#define __GAIL_SCALE_H__ - -#include "gailrange.h" -#include "gailtextutil.h" - -G_BEGIN_DECLS - -#define GAIL_TYPE_SCALE (gail_scale_get_type ()) -#define GAIL_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_SCALE, GailScale)) -#define GAIL_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_SCALE, GailScaleClass)) -#define GAIL_IS_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_SCALE)) -#define GAIL_IS_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_SCALE)) -#define GAIL_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_SCALE, GailScaleClass)) - -typedef struct _GailScale GailScale; -typedef struct _GailScaleClass GailScaleClass; - -struct _GailScale -{ - GailRange parent; - - GailTextUtil *textutil; -}; - -GType gail_scale_get_type (void); - -struct _GailScaleClass -{ - GailRangeClass parent_class; -}; - -G_END_DECLS - -#endif /* __GAIL_SCALE_H__ */ diff --git a/gtk/a11y/gailscale.c b/gtk/a11y/gtkscaleaccessible.c similarity index 71% rename from gtk/a11y/gailscale.c rename to gtk/a11y/gtkscaleaccessible.c index 1fa656b933..7e3de32da3 100644 --- a/gtk/a11y/gailscale.c +++ b/gtk/a11y/gtkscaleaccessible.c @@ -20,39 +20,36 @@ #include "config.h" #include -#include "gailscale.h" +#include "gtkscaleaccessible.h" -static const char * gail_scale_get_description (AtkObject *object); +G_DEFINE_TYPE (GtkScaleAccessible, gtk_scale_accessible, GAIL_TYPE_RANGE) -G_DEFINE_TYPE (GailScale, gail_scale, GAIL_TYPE_RANGE) - -static void -gail_scale_class_init (GailScaleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_description = gail_scale_get_description; -} - -static void -gail_scale_init (GailScale *scale) -{ -} - -static const char * -gail_scale_get_description (AtkObject *object) +static const gchar * +gtk_scale_accessible_get_description (AtkObject *object) { GtkWidget *widget; PangoLayout *layout; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); if (widget == NULL) - /* State is defunct */ return NULL; layout = gtk_scale_get_layout (GTK_SCALE (widget)); if (layout) return pango_layout_get_text (layout); - return ATK_OBJECT_CLASS (gail_scale_parent_class)->get_description (object); + return ATK_OBJECT_CLASS (gtk_scale_accessible_parent_class)->get_description (object); +} + +static void +gtk_scale_accessible_class_init (GtkScaleAccessibleClass *klass) +{ + AtkObjectClass *class = ATK_OBJECT_CLASS (klass); + + class->get_description = gtk_scale_accessible_get_description; +} + +static void +gtk_scale_accessible_init (GtkScaleAccessible *scale) +{ } diff --git a/gtk/a11y/gtkscaleaccessible.h b/gtk/a11y/gtkscaleaccessible.h new file mode 100644 index 0000000000..648130b77e --- /dev/null +++ b/gtk/a11y/gtkscaleaccessible.h @@ -0,0 +1,52 @@ +/* GAIL - The GNOME Accessibility Implementation Library + * Copyright 2004 Sun Microsystems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GTK_SCALE_ACCESSIBLE_H__ +#define __GTK_SCALE_ACCESSIBLE_H__ + +#include "gailrange.h" +#include "gailtextutil.h" + +G_BEGIN_DECLS + +#define GTK_TYPE_SCALE_ACCESSIBLE (gtk_scale_accessible_get_type ()) +#define GTK_SCALE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessible)) +#define GTK_SCALE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass)) +#define GTK_IS_SCALE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_ACCESSIBLE)) +#define GTK_IS_SCALE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_ACCESSIBLE)) +#define GTK_SCALE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass)) + +typedef struct _GtkScaleAccessible GtkScaleAccessible; +typedef struct _GtkScaleAccessibleClass GtkScaleAccessibleClass; + +struct _GtkScaleAccessible +{ + GailRange parent; +}; + +struct _GtkScaleAccessibleClass +{ + GailRangeClass parent_class; +}; + +GType gtk_scale_accessible_get_type (void); + +G_END_DECLS + +#endif /* __GTK_SCALE_ACCESSIBLE_H__ */ diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 042722e2a0..979f45f66b 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -42,6 +42,8 @@ #include "gtkbuildable.h" #include "gtkbuilderprivate.h" +#include "a11y/gtkscaleaccessible.h" + /** * SECTION:gtkscale @@ -410,6 +412,8 @@ gtk_scale_class_init (GtkScaleClass *class) GTK_SCROLL_END); g_type_class_add_private (gobject_class, sizeof (GtkScalePrivate)); + + gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCALE_ACCESSIBLE); } static void -- 2.30.2